package com.codemart.lanze.common.base.controller;

import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xiaoleilu.hutool.log.Log;
import com.xiaoleilu.hutool.log.LogFactory;

/**
 * 统一错误处理 404 500
 */
@Controller
public class GlobalErrorController implements ErrorController {

	private static final Log LOG = LogFactory.get();

	private static final String ERROR_PATH = "/error";

	@RequestMapping(value = ERROR_PATH)
	public String handleError() {
		LOG.error("访问的页面不存在！");
		return "admin/common/404";
	}

	@Override
	public String getErrorPath() {
		return ERROR_PATH;
	}
}
